import { createStore } from 'vuex'
let userName = ''
try {
  if (localStorage.userName) {
    userName = localStorage.userName
  }
} catch (e) {}
let userDepart = ''
try {
  if (localStorage.userDepart) {
    userDepart = localStorage.userDepart
  }
} catch (e) {}
let userRegion = ''
try {
  if (localStorage.userRegion) {
    userRegion = localStorage.userRegion
  }
} catch (e) {}

export default createStore({
  state: {
    userName,
    userDepart,
    userRegion,
    sjbqDialog:0,
    sjhjCenterState: "a",
    sjhjCenterShow:false,
    sjzlCenterState: "a",
    sjzlCenterShow:false,
    descShow :false,
    hngkComponent:'Gk',
    jcyjComponent:'Hy',
    panoramaStatus:false,
    currentPanoramaImg:"",
    nameTitleContent:null,
    sjzlCenterContent:null,
    psvShow:true,
    psvUrl:null,
    //数据中心左侧面板
    leftPanelShow:true,
    //数据中心图例变化
    sjzxLegendPosition:true,
    //左侧面板动态组件
    sjzxLeftCurrentComponent:'SjzxBasic',
    //数据中心右侧组件名称
    sjzxRightCurrentComponent:"FxffThematicMap",
    //专题图名称
    thematicMapName: "防汛防风",
    //被选中的图例
    checkedCities:[],
    //数据中心弹框的显示隐藏
    sjzxBasicDetail:false,
    //防汛防风专题图被选中时的类型
    fxffThematicMapCheckedContent:null,
    //防汛防风专题报告被选中时的类型
    fxffFormCheckedContent:null,
    //球上弹窗信息
    infoBoxContent:null,
    infoBoxThreeContent:{
        "隐患基本情况":{},
        "市县落实情况":{},
        "省级行业主管部门核查情况":{}
    },
    //火情专题图
    showFireDetail:false,
    //
    fireId:null,
    earthList:null,
    ycList:[],
    reportFireId:'',
    dayReportFireTime:'',
    sjzxLeftHistoryFireTj:null,
    //风险防空页面
    //风险防控右侧面板显隐
    fxfkRightShow:false,
    //风险防控右侧数据内容
    fxfkRightContent:null,
    //生产安全事故，报表查看
    dangerDayForm:null,
    //风险防控
    fxgkRightShow:false,
    //控制防汛防风图例显示
    fxffLegend:false,
    //地质灾害list
    DZZHList:null,
    fireLegendShow:false,
    VisAuth:'',
    circleRadius:3,
    // 实时渔船
    realtimeYC:"",
    constructGD:"",
  },
  mutations: {
    changeUserName(state,userName){
        state.userName = userName
        try {
            localStorage.userName = userName
        } catch (e) {}
    },
    changeUserDepart(state,userDepart){
        state.userDepart = userDepart
        try {
            localStorage.userDepart = userDepart
        } catch (e) {}
    },
    changeUserRegion(state,userRegion){
        state.userRegion = userRegion
        try {
            localStorage.userRegion = userRegion
        } catch (e) {}
    },
    changePsvShow(state,psvShow){
        state.psvShow = psvShow
    },
    changePsvUrl(state,psvUrl){
        state.psvUrl = psvUrl
    },
    changeSjzlCenterContent(state,sjzlCenterContent){
        state.sjzlCenterContent = sjzlCenterContent
    },
    changeNameTitle(state,nameTitleContent){
        state.nameTitleContent = nameTitleContent
    },
    changeDialogState(state,sjbqDialog){
      state.sjbqDialog = sjbqDialog
    },
    changeSjhjCenterState(state, sjhjCenterState){
      state.sjhjCenterState = sjhjCenterState
    },
    changeSjhjCenterShow(state,sjhjCenterShow){
      state.sjhjCenterShow = sjhjCenterShow
    },
    changeSjzlCenterState(state, sjzlCenterState){
        state.sjzlCenterState = sjzlCenterState
      },
    changeSjzlCenterShow(state,sjzlCenterShow){
        console.log(sjzlCenterShow)
        state.sjzlCenterShow = sjzlCenterShow
    },
    changeDescShow(state,descShow){
      state.descShow = descShow
    },
    changeHngkComponent(state , hngkComponent){
      state.hngkComponent = hngkComponent
    },
    changeJcyjComponent(state , jcyjComponent){
      state.jcyjComponent = jcyjComponent
    },
    changePanoramaStatus(state ,panoramaStatus){
        state.panoramaStatus = panoramaStatus
    },
    changeCurrentPanoramaImg(state,currentPanoramaImg){
        state.currentPanoramaImg = currentPanoramaImg
    },
    // 数据中心,图例
    changeSjzxLegendPosition(state,sjzxLegendPosition){
        state.sjzxLegendPosition = sjzxLegendPosition
    },
    //防汛防风，图例显示
    changeFxffLegendShow(state,fxffLegendShow){
        state.fxffLegendShow = fxffLegendShow
    },
    //修改数据中心左侧面板当前组件
    changeSjzxLeftCurrentComponent(state,sjzxLeftCurrentComponent){
        state.sjzxLeftCurrentComponent = sjzxLeftCurrentComponent
    },
    //修改数据中心右侧面板当前组件
    changeSjzxRightCurrentComponent(state,sjzxRightCurrentComponent){
        state.sjzxRightCurrentComponent = sjzxRightCurrentComponent
    },
    //修改数据中心专题图名称
    changeThematicMapName(state,thematicMapName){
        state.thematicMapName = thematicMapName
    },
    //防汛防风被选中的类型
    changeCheckedCities(state, checkedCities){
        state.checkedCities = checkedCities
    },
    //数据中心弹窗的显示或者隐藏
    changeSjzxBasicDetail(state, sjzxBasicDetail){
        state.sjzxBasicDetail = sjzxBasicDetail
    },
    //修改防汛防风专题图右侧内容
    changeFxffThematicMapCheckedContent(state, fxffThematicMapCheckedContent){
        state.fxffThematicMapCheckedContent = fxffThematicMapCheckedContent
    },
    //改变防风防汛报表内容
    changeFxffFormCheckedContent(state, fxffFormCheckedContent){
        state.fxffFormCheckedContent = fxffFormCheckedContent
    },
    //改变弹框信息
    changeInfoBoxContent(state, infoBoxContent){
        state.infoBoxContent = infoBoxContent
    },
    //改变防汛防风弹框信息
    changeInfoBoxThreeContent(state, infoBoxThreeContent){
        state.infoBoxThreeContent = infoBoxThreeContent
    },
    //显示火情详细信息
    changeShowFireDetail(state, showFireDetail){
        state.showFireDetail = showFireDetail
    },

    changeFireId(state, fireId){
        state.fireId = fireId
    },
    //火情报表信息
    changeEarthList(state,earthList){
        state.earthList = earthList
    },
    //改变list
    changeYCList(state,ycList){
        state.ycList = ycList
    },
    //火情报告id
    changeReportFireId(state,reportFireId){
        state.reportFireId = reportFireId
    },
    //火情报告时间
    changeDayReportFireTime(state,dayReportFireTime){
        state.dayReportFireTime = dayReportFireTime
    },
    //历史火情统计信息
    changeSjzxLeftHistoryFireTj(state,sjzxLeftHistoryFireTj){
        state.sjzxLeftHistoryFireTj = sjzxLeftHistoryFireTj
    },
    //防汛防风显示隐藏
    changeFxfkRightShow(state,fxfkRightShow){
        state.fxfkRightShow = fxfkRightShow
    },
    //风险防控页面数据
    changeFxfkRightContent(state,fxfkRightContent){
        state.fxfkRightContent = fxfkRightContent
    },
    //生产安全日报
    changeDangerDayForm(state,dangerDayForm){
        state.dangerDayForm = dangerDayForm
    },
    //风险防控右侧页面数据
    changeFxgkRightShow(state,fxgkRightShow){
        state.fxgkRightShow = fxgkRightShow
    },
    //DZZHList 地质灾害列表
    changeDZZHList(state,DZZHList){
        state.DZZHList = DZZHList
    },
    //左侧面板显示
    changeLeftPanelShow(state,leftPanelShow){
        state.leftPanelShow = leftPanelShow
    },
    //火情图例显示
    changeFireLegendShow(state,fireLegendShow){
        state.fireLegendShow = fireLegendShow
    },
    changeVisAuth(state,VisAuth){
        state.VisAuth = VisAuth
    },
    //改变 火情简报半径
    changeCircleRadius(state,circleRadius){
        state.circleRadius = circleRadius
    },
    // 实时渔船
    changeRealtimeYC(state,realtimeYC){
        state.realtimeYC = realtimeYC
    },
    // 在建工地
    changeConstructGD(state,constructGD){
        state.constructGD = constructGD
    }
  },
  actions: {
  },
  modules: {
  }
})